{
Ultibo CP850 (OEM) interface unit.

Copyright (C) 2016 - SoftOz Pty Ltd.

Arch
====

 <All>

Boards
======

 <All>

Licence
=======

 LGPLv2.1 with static linking exception (See COPYING.modifiedLGPL.txt)
 
Credits
=======

 Information for this unit was obtained from:

 
References
==========


CP850 OEM (Latin I)
===================

 Note: The equivalent ANSI code page for CP850 is CP1252 (Latin I) which is included 
 in the Locale unit as the default ANSI code page.
 
}

{$mode delphi} {Default to Delphi compatible syntax}
{$H+}          {Default to AnsiString}
{$inline on}   {Allow use of Inline procedures}

unit CP850OEM;

interface

uses GlobalConfig,GlobalConst,GlobalTypes,Locale;

{==============================================================================}
{Global definitions}
{$INCLUDE ..\core\GlobalDefines.inc}
        
{==============================================================================}
{const}
 {CP850OEM specific constants}

{==============================================================================}
{type}
 {CP850OEM specific types}

{==============================================================================}
{var}
 {CP850OEM specific variables}

{==============================================================================}
{Initialization Functions}
procedure CP850OEMInit;
 
{==============================================================================}
{CP850OEM Functions}
 
{==============================================================================}
{CP850OEM Helper Functions}
 
{==============================================================================}
{==============================================================================}

implementation

{==============================================================================}
{==============================================================================}
var
 {CP850OEM specific variables}
 CP850OEMInitialized:Boolean;

 CPOEM850:TCodeTable = (
  MaxCharSize:1;
  DefaultChar:(
  $3F,$00);
  LeadByte:(
  $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00);
  Values:(
  $0000,$0001,$0002,$0003,$0004,$0005,$0006,$0007,
  $0008,$0009,$000A,$000B,$000C,$000D,$000E,$000F,
  $0010,$0011,$0012,$0013,$0014,$0015,$0016,$0017,
  $0018,$0019,$001A,$001B,$001C,$001D,$001E,$001F,
  $0020,$0021,$0022,$0023,$0024,$0025,$0026,$0027,
  $0028,$0029,$002A,$002B,$002C,$002D,$002E,$002F,
  $0030,$0031,$0032,$0033,$0034,$0035,$0036,$0037,
  $0038,$0039,$003A,$003B,$003C,$003D,$003E,$003F,
  $0040,$0041,$0042,$0043,$0044,$0045,$0046,$0047,
  $0048,$0049,$004A,$004B,$004C,$004D,$004E,$004F,
  $0050,$0051,$0052,$0053,$0054,$0055,$0056,$0057,
  $0058,$0059,$005A,$005B,$005C,$005D,$005E,$005F,
  $0060,$0061,$0062,$0063,$0064,$0065,$0066,$0067,
  $0068,$0069,$006A,$006B,$006C,$006D,$006E,$006F,
  $0070,$0071,$0072,$0073,$0074,$0075,$0076,$0077,
  $0078,$0079,$007A,$007B,$007C,$007D,$007E,$007F,
  $00C7,$00FC,$00E9,$00E2,$00E4,$00E0,$00E5,$00E7,
  $00EA,$00EB,$00E8,$00EF,$00EE,$00EC,$00C4,$00C5,
  $00C9,$00E6,$00C6,$00F4,$00F6,$00F2,$00FB,$00F9,
  $00FF,$00D6,$00DC,$00F8,$00A3,$00D8,$00D7,$0192,
  $00E1,$00ED,$00F3,$00FA,$00F1,$00D1,$00AA,$00BA,
  $00BF,$00AE,$00AC,$00BD,$00BC,$00A1,$00AB,$00BB,
  $2591,$2592,$2593,$2502,$2524,$00C1,$00C2,$00C0,
  $00A9,$2563,$2551,$2557,$255D,$00A2,$00A5,$2510,
  $2514,$2534,$252C,$251C,$2500,$253C,$00E3,$00C3,
  $255A,$2554,$2569,$2566,$2560,$2550,$256C,$00A4,
  $00F0,$00D0,$00CA,$00CB,$00C8,$0131,$00CD,$00CE,
  $00CF,$2518,$250C,$2588,$2584,$00A6,$00CC,$2580,
  $00D3,$00DF,$00D4,$00D2,$00F5,$00D5,$00B5,$00FE,
  $00DE,$00DA,$00DB,$00D9,$00FD,$00DD,$00AF,$00B4,
  $00AD,$00B1,$2017,$00BE,$00B6,$00A7,$00F7,$00B8,
  $00B0,$00A8,$00B7,$00B9,$00B3,$00B2,$25A0,$00A0)
 );
 
 CP1252TO850:TTransTable = (
  TransID:850;
  Values:(
  $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F,
  $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F,
  $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,
  $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F,
  $40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4A,$4B,$4C,$4D,$4E,$4F,
  $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F,
  $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6A,$6B,$6C,$6D,$6E,$6F,
  $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7A,$7B,$7C,$7D,$7E,$7F,
  $5F,$5F,$27,$9F,$22,$2E,$C5,$CE,$5E,$25,$53,$3C,$4F,$5F,$5A,$5F,
  $5F,$27,$27,$22,$22,$07,$2D,$2D,$7E,$54,$73,$3E,$6F,$5F,$7A,$59,
  $FF,$AD,$BD,$9C,$CF,$BE,$DD,$F5,$F9,$B8,$A6,$AE,$AA,$F0,$A9,$EE,
  $F8,$F1,$FD,$FC,$EF,$E6,$F4,$FA,$F7,$FB,$A7,$AF,$AC,$AB,$F3,$A8,
  $B7,$B5,$B6,$C7,$8E,$8F,$92,$80,$D4,$90,$D2,$D3,$DE,$D6,$D7,$D8,
  $D1,$A5,$E3,$E0,$E2,$E5,$99,$9E,$9D,$EB,$E9,$EA,$9A,$ED,$E8,$E1,
  $85,$A0,$83,$C6,$84,$86,$91,$87,$8A,$82,$88,$89,$8D,$A1,$8C,$8B,
  $D0,$A4,$95,$A2,$93,$E4,$94,$F6,$9B,$97,$A3,$96,$81,$EC,$E7,$98)
 );
 
 CP850TO1252:TTransTable = (
  TransID:1252;
  Values:(
  $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$A4,
  $10,$11,$12,$13,$B6,$A7,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F,
  $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,
  $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F,
  $40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4A,$4B,$4C,$4D,$4E,$4F,
  $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F,
  $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6A,$6B,$6C,$6D,$6E,$6F,
  $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7A,$7B,$7C,$7D,$7E,$7F,
  $C7,$FC,$E9,$E2,$E4,$E0,$E5,$E7,$EA,$EB,$E8,$EF,$EE,$EC,$C4,$C5,
  $C9,$E6,$C6,$F4,$F6,$F2,$FB,$F9,$FF,$D6,$DC,$F8,$A3,$D8,$D7,$83,
  $E1,$ED,$F3,$FA,$F1,$D1,$AA,$BA,$BF,$AE,$AC,$BD,$BC,$A1,$AB,$BB,
  $A6,$A6,$A6,$A6,$A6,$C1,$C2,$C0,$A9,$A6,$A6,$2B,$2B,$A2,$A5,$2B,
  $2B,$2D,$2D,$2B,$2D,$2B,$E3,$C3,$2B,$2B,$2D,$2D,$A6,$2D,$2B,$A4,
  $F0,$D0,$CA,$CB,$C8,$69,$CD,$CE,$CF,$2B,$2B,$A6,$5F,$A6,$CC,$AF,
  $D3,$DF,$D4,$D2,$F5,$D5,$B5,$FE,$DE,$DA,$DB,$D9,$FD,$DD,$AF,$B4,
  $AD,$B1,$3D,$BE,$B6,$A7,$F7,$B8,$B0,$A8,$B7,$B9,$B3,$B2,$A6,$A0)
 );
 
{==============================================================================}
{==============================================================================}
{Initialization Functions}
procedure CP850OEMInit;
begin
 {}
 {Check Initialized}
 if CP850OEMInitialized then Exit;

 {Load Default Code Pages}
 LoadPage(CP_OEM_850,@CPOEM850,nil,nil);
 InstallTrans(CP_OEM_850,@CP850TO1252);
 InstallTrans(CP_ANSI_1252,@CP1252TO850);

 CP850OEMInitialized:=True;
end;

{==============================================================================}
{==============================================================================}
{CP850OEM Functions}

{==============================================================================}
{==============================================================================}
{CP850OEM Helper Functions}

{==============================================================================}
{==============================================================================}

initialization
 CP850OEMInit;
 
{==============================================================================}
 
finalization
 {Nothing}

{==============================================================================}
{==============================================================================}

end.
